﻿using System;
using System.Collections;
using System.Collections.Generic;
using LiveLinq;
using NUnit.Framework;

namespace LiveLinqTests
{
	[TestFixture]
	public class MethodEmpty
	{
		[Test]
		public void Empty_method_should_exists()
		{
			var emp = ObservableEnumerable.Empty<IItem>();
			Assert.AreEqual(0, System.Linq.Enumerable.Count(emp));
			CollectionAssert.AreEqual(System.Linq.Enumerable.Empty<IItem>(), emp);

			var empList = emp as IList<IItem>;
			if (empList != null)
			{
				var ok = false;
				try
				{
					empList.Add(new Item(1));
				}
				catch
				{
					ok = true;
				}
				Assert.IsTrue(ok);
			}

			var empList2 = emp as IList;
			if (empList2 != null)
			{
				var ok = false;
				try
				{
					empList2.Add(new Item(1));
				}
				catch
				{
					ok = true;
				}
				Assert.IsTrue(ok);
			}


		}
	}
}